<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<%@ page import="java.util.Calendar, com.scalar.chiptrack.utils.ConfigManager"%>

<chiptrack:checkLogon sourcePage="/salesReport.do?action=shippingreport" />


<HTML><HEAD>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></SCRIPT>
<script>
var dateElement = "";

function openCalendar(dateValue)
{
        dateElement = dateValue;
        newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
        newWindow.moveTo(550,180);
        newWindow.focus();
}
function assignDate(passedValue)
{
        dateElement.value=passedValue;
        window.focus();
}


function finance(){


    /*var pa=document.getElementById("errors");
    pa.innerHTML="";
    if( document.revenueReport.period.checked == true )
    {
        if( document.revenueReport.quarter.value == 'All' )
        {
               pa.innerHTML = "<li> Please select Quarter other than All (or) Deselect the By Month Check Box ";
               return false
        }

    }*/

    var d = new Date();
    var day = d.getDate();
    var month = d.getMonth()+1;
    var year = d.getFullYear();
    var hour = d.getHours();
    var min = d.getMinutes();
    var sec = d.getSeconds();

    var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;
    document.revenueReport.prompt5.value = defaultPrompt;

    if (document.revenueReport.quarter.value == '')
        document.revenueReport.prompt2.value = '0';
    else
        document.revenueReport.prompt2.value = document.revenueReport.quarter.value;

    if (document.revenueReport.year.value == '')
        document.revenueReport.prompt3.value = '0';
    else
        document.revenueReport.prompt3.value = document.revenueReport.year.value;


    /*var success;
    success = true;
    success = validateFromAndToDates();
    if( success == false )
    {
       return false;
    }*/

    for (counter = 0; counter < revenueReport.category.length; counter++)
	{
		if (revenueReport.category[counter].checked)
        {
            byPeriod = revenueReport.category[counter].value;
            document.revenueReport.prompt4.value = revenueReport.category[counter].value;
		}
	}

   /* var byType = "";
    for (counter = 0; counter < revenueReport.reportType.length; counter++)
	{
		if (revenueReport.reportType[counter].checked)
        {
            byType = revenueReport.reportType[counter].value;
		}
	}


    var byQtr  = document.revenueReport.quarter.value

    if (  byType == "ByDetail" )
    {
	    if( byQtr == 'All' && document.revenueReport.period.checked == false )
        {
            document.revenueReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/SummaryReports/REVENUE_REPORT_BY_PRODUCT_BY_DETAIL_BY_ALLQUARTERS.rpt";
        }
        if( byQtr != 'All' && document.revenueReport.period.checked == true )
        {
            document.revenueReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/SummaryReports/REVENUE_REPORT_BY_PRODUCT_BY_DETAIL_BY_MONTH_BY_QUARTER.rpt";
        }
        if( byQtr != 'All' && document.revenueReport.period.checked == false )
        {
            document.revenueReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/SummaryReports/REVENUE_REPORT_BY_PRODUCT_BY_DETAIL_BY_QUARTER.rpt";
        }
    }
    else if (  byType == "BySummary" )
    {
		 if( byQtr == 'All' && document.revenueReport.period.checked == false )
        {
            document.revenueReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/SummaryReports/REVENUE_REPORT_BY_SUMMARY_BY_DETAIL_BY_ALLQUARTERS.rpt";
        }
        if( byQtr != 'All' && document.revenueReport.period.checked == true )
        {
            document.revenueReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/SummaryReports/REVENUE_REPORT_BY_SUMMARY_BY_DETAIL_BY_MONTH_BY_QUARTER.rpt";
        }
        if( byQtr != 'All' && document.revenueReport.period.checked == false )
        {
            document.revenueReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Sales/SummaryReports/REVENUE_REPORT_BY_SUMMARY_BY_DETAIL_BY_QUARTER.rpt";
        }
   	}*/

    document.revenueReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Finance/Revenue/REVENUE_REPORT_BY_ENDCUSTOMER.rpt";
    document.revenueReport.submit();

    return true;
}

/*function validateFromAndToDates()
{
    formdoc = document.revenueReport;
    errMsg = '';

    var pa	= document.getElementById("errors")

    if(chkDate(formdoc.datefrom.value,'From-Date','N') == false)
    {
        pa.innerHTML = errMsg;
        formdoc.datefrom.focus();
        return false;
    }

    if(chkDate(formdoc.dateto.value,'To-Date','N') == false)
    {
        pa.innerHTML = errMsg;
        formdoc.dateto.focus();
        return false;
    }

    if(formdoc.datefrom.value!='' && formdoc.dateto.value!='')
    {
        if (!validateDateOut(formatDateAsMMDDYYYY(formdoc.datefrom.value),formatDateAsMMDDYYYY(formdoc.dateto.value)))
        {
            pa.innerHTML = "To Date cannot be less than From Date";
            formdoc.dateto.focus();
            return false;
        }
    }
    return true;
}*/

/*function chkQuarter(){

    var pa=document.getElementById("errors");
    pa.innerHTML = "";
    if( document.revenueReport.period.checked == true )
    {
        if( document.revenueReport.quarter.value == 'All' )
        {
              pa.innerHTML = "<li> Please select Quarter other than 'All' ";
              return false
        }

    }
    return true
}*/

</script>
<TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel=stylesheet>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<form name="revenueReport" method="post">
<input type="hidden" name="prompt2">
<input type="hidden" name="prompt3">
<input type="hidden" name="prompt4">
<input type="hidden" name="prompt5">
<%--End of Modication by lavanya , July 26 --%>
<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@ include file="/jsp/finance/finance_reports_menu.jsp" %>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
  <table border="0" width="85%" align='center'>
    <tr>
        <td colspan="6">
            <table border="0" width="65%" align='center'>
 	            <tr>
                    <td width="15%" class="NArialL">&nbsp;</td>
                    <td width="75%" colspan=3 align='left' class="NArialW">Revenue End Customer Report</td>
                    <td width="10%"><font class="NArialL">&nbsp;</td>
               </tr>
            </table>
        </td>
<%--        <td width="20%" colspan=1><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>&nbsp;</td>
        <td width="70%" colspan=3 align='left' class="NArialW">Revenue Report</td>
        <td width="10%" colspan=1><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>&nbsp;</td>--%>
    </tr>
    <tr><td colspan="6"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
    <tr>
        <td width="10%">&nbsp;</td>
        <td width="90%" colspan="5">
        <b><font styleClass="NArialL" size="1" id='errors' color="FF0000" align="center"></font><b>
        </td>
    </tr>
    </table>
    <table border="0" width="65%" align='center'>
 	<tr>
        <td width="12%" class="NArialL">Base Products</td>
        <td width="10%"><font class="NArialL">
            <select size="1" name="prompt0" class="txfield">
                <option value="0">All Products</option>
                <logic:iterate id="baseProductSelectList" name="baseProductList">
                    <logic:notEqual name="baseProductSelectList" value="null">
                        <option value = "<bean:write name="baseProductSelectList" property="value"/>" >
                            <bean:write name="baseProductSelectList" property="label"/>
                        </option>
                    </logic:notEqual>
                </logic:iterate>
            </select>
        </td>
        <td colspan=3><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>&nbsp;</td>
   </tr>
         <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
    <tr>
          <td width="12%"><font class="NArialL"><bean:message key="label.sales.endCustomer"/></font></td>
          <td width="10%"><font class="NArialL">
              <select size="1" name="prompt1" class="txfield" >
                <option value="0" >Select Any <bean:message key="label.sales.endCustomer"/></option></option>
                <logic:iterate id="endUserList" name="endUserList">
                    <logic:notEqual name="endUserList" value="null">
                        <option value = "<bean:write name="endUserList" property="value"/>">
                            <bean:write name="endUserList" property="label"/>
                        </option>
                    </logic:notEqual>
                </logic:iterate>

              </select>
          </td>
           <td colspan=3><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>&nbsp;</td>
     </tr>

       <tr>
         <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
        <tr>

        <td width="5%"><font class="NArialL">Year&nbsp;&nbsp;</font>
           <html:select name="revenueReport" property="year" styleClass="txfield" value='<%=Integer.toString(Calendar.getInstance().get (Calendar.YEAR))%>'>
           <html:options collection="years" property="value" labelProperty="label" />
        </html:select>
        </td>
        <td width="5%"><font class="NArialL">Quarter&nbsp;&nbsp;</font>
     	  <select name="quarter" class="txfield">
          <% String currentQtr = (String) request.getAttribute("currentQtr"); %>
           <logic:iterate id="quarterList" name="quarterList">
        	    <logic:notEqual name="quarterList" value="null">
                    <logic:equal name="quarterList" property="value" value="<%=currentQtr%>">
                        <option value = "<bean:write name="quarterList" property="value"/>" SELECTED>
                            <bean:write name="quarterList" property="label"/>
                        </option>
                    </logic:equal>
                    <logic:notEqual name="quarterList" property="value" value="<%=currentQtr%>">
                        <option value = "<bean:write name="quarterList" property="value"/>" >
                            <bean:write name="quarterList" property="label"/>
                        </option>
                    </logic:notEqual>
                </logic:notEqual>
            </logic:iterate>
        </select>
      </td>
     </tr>
     <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
     <%--<tr>
           <td colspan=5>
                <input type="checkbox" name="period" value="ByMonth" onClick="javascript:return chkQuarter();">
                <font class="NArialL">By Month</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--%>
              <%--  <input type="checkbox" name="period" value="ByQuarter" checked disabled=true>
                <font class="NArialL">By Quarter</font> --%>
           <%-- </td>
        </tr>
        <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr> --%>
     <!--<tr>
            <td colspan=5>
                <input type="radio" name="reportType" value="ByDetail" >
                <font class="NArialL">By Detail</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio" name="reportType" value="BySummary" checked>
                <font class="NArialL">By Summary</font>
            </td>
    </tr>
    <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>-->
    <tr>
        <td colspan=5>
                <input type="radio" name="category" value="REQUESTED" checked>
                <font class="NArialL">By Requested Date</font>&nbsp;&nbsp;&nbsp;&nbsp;
                <input type="radio" name="category" value="SCHEDULE">
                <font class="NArialL">By Schedule Date</font>
            </td>
    </tr>
     <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>

    <tr>
      <td colspan=2 align="center">
	  <input type="image" onClick="javascript:return finance();"  border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17" onmouseover="window.status='Click to Generate Revenue Report';return true"onmouseout="window.status='';return true"title="Click here to Generate Revenue Report">
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <a href="javascript:document.revenueReport.reset();"><img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true"title="Click here to Reset"></a>
      </td>
      <td colspan=1><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>&nbsp;</td>
    </tr>
   </table>
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</form>
</BODY>
</HTML>
